from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseRedirect
 
from functools import wraps
 
def gameStatus(permission):
    def decorator(func):
        def inner_decorator(request, *args, **kwargs):
            if request.session['user_profile'].is_account_admin == 1:
                return func(request, *args, **kwargs)
            else:
                return HttpResponseRedirect(reverse('travel_game.views.dayAction'))
 
        return wraps(func)(inner_decorator)
 
    return decorator